#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
//默认从大到小
priority_queue<int> b;
//从小到大
priority_queue<int,vector<int>,greater<int>> s;
vector<int> res;
int main(void){
    int n;
    while(~scanf("%d",&n)){
        res.clear();
        while(!b.empty()){
            b.pop();
        }
        while(!s.empty()){
            s.pop();
        }
        int t;
        for(int i=0;i<n;i++){
            scanf("%d",&t);
            b.push(t);
            s.push(t);
        }
        for(int i=0;i<(n+1)/2;i++){
            if(b.top()!=s.top()){
                res.push_back(b.top());
                res.push_back(s.top());
                b.pop();
                s.pop();
            }
            else{
                res.push_back(b.top());
                b.pop();
                s.pop();
            }
        }
        for(int i=0;i<res.size()-1;i++){
            printf("%d ",res[i]);
        }
        printf("%d\n",res[res.size()-1]);
    }
    return 0;
}
